package com.promis.party.ui.partywork.dailywork.tracking;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;

import com.promis.compat.StatusBarCompat;
import com.promis.party.R;
import com.promis.party.helper.ContextHelper;
import com.promis.party.helper.UIHepler;
import com.promis.widget.paging.PageRefreshRecyclerView;
import com.promis.widget.recycler.LinearSpacingItemDecoration;
import com.promis.widget.recycler.RecyclerLayoutManagerHelper;

/**
 * Created by zcy on 2018/9/25.
 */

public class TrackingSuperviseDetailActivity extends AppCompatActivity {

    private ContextHelper contextHelper;
    private TrackingSuperviseDetailListAdapter adapter;
    private RecyclerView recyclerView;
    private LinearLayout llyvSubmit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarCompat.translucentStatusBar(this);
        StatusBarCompat.blackTextStatusBar(this);
        setContentView(R.layout.activity_tracking_supervise_detail);

        UIHepler.goBack(TrackingSuperviseDetailActivity.this, R.id.activity_tracking_supervise_detail_imgv_back);
        llyvSubmit = findViewById(R.id.activity_tracking_supervise_detail_llyv_submit);
        recyclerView = findViewById(R.id.activity_tracking_supervise_detail_rcyv);

        initData();
        initListener();
    }

    private void initData() {
        contextHelper = new ContextHelper(getBaseContext());

//        RecyclerView recycler = recyclerView.getRecyclerView();
        RecyclerLayoutManagerHelper.buildVerticalLinearLayoutManager(getBaseContext(), recyclerView);
        recyclerView.addItemDecoration(new LinearSpacingItemDecoration(getBaseContext(), LinearLayoutManager.VERTICAL, 0, R.color.split_line));
        adapter = new TrackingSuperviseDetailListAdapter(getBaseContext());
        recyclerView.setAdapter(adapter);
    }

    private void initListener() {
        llyvSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(getBaseContext(), TrackingSuperviseResultActivity.class);
                startActivity(intent);
            }
        });
    }

//    public void httpFindDynamicList() {
//        HttpJsonParams params = new HttpJsonParams();
//        params.add("interest",1);
//        if (UserPreferences.getInstance(getContext()).exists()) {
//            params.add("userId", UserPreferences.getInstance(getContext()).getId());
//        }
//        String url = contextHelper.getServiceUrl(R.string.findInterestDynamicList);
//        new HttpClient<JsonList<Dynamic>>(getContext()) {
//            @Override
//            protected void onSuccess(JsonList<Dynamic> result) {
//                dynamicList = result.getDataList();
//                adptAdopt.notifyDataSetChanged(dynamicList);
//            }
//        }.postAsyn(url, params);
//    }
}